# for a * b = c, a < b ( < c)
# since len(a) + len(b) + len(c) == 9
# and la <= lb <= lc
# and la + lb - 1 <= lc <= la + lb
# so la <= 3, 
# and 0 not allowed
# we don't have much options

from math import pow

all = set()

for a in range(1, 1000): # 
    sa = str(a)
    if '0' in sa:
        continue
    la = len(sa)
    for b in range(int(pow(10, (9 - la * 2)/2 - 2)), int(pow(10, (9 - la * 2)/2 + 1))):
        sb = str(b)
        if '0' in sb:
            continue
        lb = len(sb)
        lall = set(sa + sb)
        if len(lall) < la + lb:
            continue
        c = a * b
        sc = str(c)
        lc = len(sc)
        if la + lb + lc != 9:
            continue
        if '0' in sc:
            continue
        lall.update(sc)
        if len(lall) != 9:
            continue
        print '%d + %d = %d' % (a, b, c)
        all.add(c)

print sum(all)